﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EBA.IoC
{
    public class ImportConventions : IEnumerable<ImportConvention>
    {

        public ImportConventions()
        {
        }

        Dictionary<Type, ImportConvention> Items = new Dictionary<Type, ImportConvention>();
        public ImportConvention this[Type type]
        {
            get
            {
                ImportConvention val;

                this.Items.TryGetValue(type,out val);

                return val;

            }
            set
            {
                //TODO:thread safe
                this.Items[type] = value;
            }
        }



        public IEnumerator<ImportConvention> GetEnumerator()
        {
            return this.Items.Select(i => i.Value).GetEnumerator();
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return this.Items.Select(i => i.Value).GetEnumerator();
        }

    }
}
